﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Display;


namespace EAGL.Display.Rendering
{
    public class SimpleAreaRenderer: Renderer
    {
        
    #region =================== PROTECTED ====================
        
        protected Color fillColor;
        protected esriSimpleFillStyle fillStyle;
        protected Color outlineColor;
        protected double outlineWidth;
       
        protected override void createRenderer()
        {
            ISimpleFillSymbol fsym = new SimpleFillSymbolClass();
            fsym.Color = ColorManager.GetESRIColor(this.fillColor);
            fsym.Style = this.fillStyle;
            ILineSymbol lsym = new SimpleLineSymbolClass();
            lsym.Color = ColorManager.GetESRIColor(this.outlineColor);
            lsym.Width = this.outlineWidth;
            fsym.Outline = lsym;

            ISimpleRenderer r = new SimpleRendererClass();
            r.Symbol = fsym as ISymbol;
            r.Label = this.label;
            r.Description = description;
            this.renderer = r as IFeatureRenderer;
        }


    #endregion

    #region ==================== PUBLIC ======================

        public SimpleAreaRenderer(string Label, string Description)
        {
            this.label = Label;
            this.description = Description;
            
            // assign default values
            this.fillColor = Color.Beige;
            this.fillStyle = esriSimpleFillStyle.esriSFSSolid;
            this.outlineColor = Color.Black;
            this.outlineWidth = 1;
        }

        public SimpleAreaRenderer(string Label)
            : this(Label, "") { }

        public SimpleAreaRenderer()
            : this("") { }


        public Color FillColor
        {
            get { return this.fillColor; }
            set { this.fillColor = value; }
        }

        public esriSimpleFillStyle FillStyle
        {
            get { return this.fillStyle; }
            set { this.fillStyle = value; }
        }

        public Color OutlineColor
        {
            get { return this.outlineColor; }
            set { this.outlineColor = value; }
        }

        public double OutlineWidth
        {
            get { return this.outlineWidth; }
            set { this.outlineWidth = value; }
        }


    #endregion
    }
}
